package com.twu.biblioteca;

/**
 * Created by tinamt on 7/23/14.
 */
public class ViewAvailableItems implements Action {
    private Library library;
    Boolean isBook;

    ViewAvailableItems(Library library, Boolean isBook) {

        this.library = library;
        this.isBook = isBook;
    }

    public void execute() {
        String listOfItems;
        listOfItems = library.seeAllAvailableItems(isBook);
        if (listOfItems.isEmpty())
            System.out.println("No Items Available");
        else {
            if (isBook)
                System.out.println("Item Id\t\tName\t\t\t\tAuthor/Dir\tYear");
            else
                System.out.println("Item Id\t\tName\t\t\t\tAuthor/Dir\tYear\t\tRating");
            System.out.println(listOfItems);
        }
    }

    @Override
    public String printActionName() {

        if (isBook)
            return "View All Available Books";
        else
            return "View All Available Movies";

    }
}
